package com.qdlc.p2p.dal.model;

import org.springframework.beans.BeanUtils;

import com.qdlc.p2p.dal.dto.Lottery;

/**
 * Created by liaoxiangkai on 2015/12/1.
 */
public class LotteryModel extends Lottery {
    // 状态，0：禁用，1：启用
    public static final int STATUS_ENABLE = 1;
    public static final int STATUS_DISABLE = 0;

    private int page;
    private int rows;

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }


    /**
     * 用父类实例化model
     *
     * @param lottery
     * @return
     */
    public static LotteryModel instance(Lottery lottery) {
        LotteryModel model = new LotteryModel();
        BeanUtils.copyProperties(lottery, model);
        return model;
    }

    /**
     *
     * @param model
     * @return
     */
    public static Lottery prototype(LotteryModel model) {
        Lottery lottery = new Lottery();
        BeanUtils.copyProperties(model, lottery);
        return lottery;
    }

}
